Skip to content

Add layer overlap diagnostics#25

Merged
sjquant merged 5 commits into
mainfrom
w1c-layer-overlap
Jul 4, 2026
Merged

Add layer overlap diagnostics#25
sjquant merged 5 commits into
mainfrom
w1c-layer-overlap

Conversation

@sjquant

@sjquant sjquant commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Why

Suspicious visual overlaps need a diagnostic signal so generated specs can be repaired before rendering, without flagging compositions that only overlap in bounding boxes or transparent pixels.

Changes

  • Add layer-overlap diagnostics from measured layer geometry and render order.
  • Use bounding-box overlap as a broad-phase filter, then measure actual visible alpha-mask intersection for text, images, SVGs, and shape layers.
  • Report both bbox_overlap_pct and visible_overlap_pct with overlap pixel counts and a concrete move suggestion.
  • Preserve a fast path for simple opaque rectangles.
  • Allow text fully contained on a lower backdrop while flagging text/text, substantial partial overlaps, complete non-backdrop coverage, and non-text layers covering text.
  • Recompute per-pass alpha masks so repeated diagnostics reflect the current canvas layers.
  • Cover text/text, text/backdrop, partial overlap, ellipse corner false positives, transparent PNGs, glyph holes, full coverage, repeated diagnostics after layer mutation, non-overlap, touching edges, invisible layers, and grouped layers.

Validation

  • uv run ruff check quickthumb/_diagnostics.py tests/test_diagnostics.py
  • uv run pytest tests/test_diagnostics.py -q passes: 47 tests.
  • uv run pytest reports 703 passed, 24 skipped, 52 inline-snapshot teardown errors in rendering snapshot tests, and one external httpbin.org 503 failure in test_snapshot_url_image_background_basic.

@sjquant sjquant force-pushed the w1c-layer-overlap branch from 3344fea to c7be234 Compare July 4, 2026 07:55
@sjquant sjquant self-assigned this Jul 4, 2026
@sjquant sjquant merged commit 32edbff into main Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant